/**************************************************************************************
 *  Copyright (c)  2010  Leszek Karcz.
 *  Permission is granted to copy, distribute and/or modify this document
 *  under the terms of the GNU Free Documentation License, Version 1.3
 *  or any later version published by the Free Software Foundation;
 *  with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 *  A copy of the license is included in the section entitled "GNU
 *  Free Documentation License". 
 **************************************************************************************/
package data.tileables;
import data.Map;
import data.Player;
import data.missions.*;

/**************************************************************************************
 * Author(s): Leszek Karcz
 * Parent class for all units that are considered fighters
 **************************************************************************************/
public abstract class FighterUnit extends Unit
{

	/**************************************************************************************
	 * Author(s): Leszek Karcz
	 * FighterUnit constructor
	 **************************************************************************************/
	public FighterUnit(int ID, int supertypeID, Player player)
	{
		super(ID, supertypeID, player);
		this.setType("FighterUnit");
	}
	public boolean enqueueSelectedCommand(String mode, Map m, int x, int y) {
		this.clearMissions();
		switch(this.getSelectedCommand())
		{
		case 0:
			try  
			{  
				this.addMission(new MoveToRally(this, m, player, Integer.parseInt(mode)));
			}
			catch(Exception e){}
			break;
		case 1:
			break;
		case 2:
			this.die();
			break;
		case 3:
			if(this.getState() == 0)
				this.addMission(new PowerUpUnit(this));
			else
				this.addMission(new PowerDownUnit(this));
			break;
		}
		
		
		return true;
	}
}
